<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">


<title>编辑文档页面</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">


</head>
<body>
<form id="form1">
    <input name="button" id="Button1" type="button" onclick="SetKeyWord(true)" value="高亮显示关键字"/>
    <input name="button" id="Button2" type="button" onclick="SetKeyWord(false)" value="取消关键字显示"/>
    <div style="width: auto; height: 700px;" th:utext="${pageoffice}">

    </div>
</form>
</body>


<script type="text/javascript">
    function OnPageOfficeCtrlInit() {
        pageofficectrl.AddCustomToolButton("保存", "Save", 1);
    }
    function Save() {
        pageofficectrl.WebSave();
        //pageofficectrl.CustomSaveResult获取的是保存页面的返回值
        if (pageofficectrl.CustomSaveResult == "ok")
            alert("保存成功");
        else
            alert(pageofficectrl.CustomSaveResult);
    }
    //获取关键字
    var strKey = decodeURI(window.external.UserParams);

    function SetKeyWord(visible) {
        if (strKey == "null" || "" == strKey) {
            alert("关键字为空。");
            return;
        }
        let falg = true;
        pageofficectrl.word.HomeKey(6);
        while(falg){
            if(pageofficectrl.word.FindNextText(strKey)){
                if(visible){
                    pageofficectrl.word.SetHighlightToSelection(7);
                }else{
                    pageofficectrl.word.SetHighlightToSelection(0);
                }
            }else{
                pageofficectrl.word.HomeKey(6)
                break;
            }
        }


    }
</script>
</html>
